
function initTagSelector(defaultValue) {
	defaultValue = defaultValue || [];
	$.getJSON("/super/content/placetag?r=" + Math.random(), function(result) {
		if (result == null || result.codeWordList == null)
			return;
		var list = result.codeWordList;
		var html = "";
		for (var i = 0; i < list.length; i++) {
			if (defaultValue.contains(list[i].id)) {
				html += " <input type=\"checkbox\" name=\"placeTag[" + i + "].tagId\" value=\"" + list[i].id + "\" checked=\"true\"/>";
			} else {
				html += " <input type=\"checkbox\" name=\"placeTag[" + i + "].tagId\" value=\"" + list[i].id + "\" />";
			}
			html += list[i].name;
		}
		$("#tagSelector").html(html);
	});
}

function initSubjectSelector(defaultValue, type) {
	defaultValue = defaultValue || [];
	$.getJSON("/super/content/allsubject?subjectType=" + type + "&r=" + Math.random(), function(result) {
		if (result == null || result.codeWordList == null)
			return;
		var list = result.codeWordList;
		var html = "";
		for (var i = 0; i < list.length; i++) {
			if (defaultValue.contains(list[i].id)) {
				html += " <input type=\"checkbox\" name=\"placeSubject[" + i + "].subjectId\" value=\"" + list[i].id + "\" checked=\"true\"/>";
			} else {
				html += " <input type=\"checkbox\" name=\"placeSubject[" + i + "].subjectId\" value=\"" + list[i].id + "\" />";
			}
			html += list[i].name;
		}
		$("#subjectSelector").html(html);
	});
}